import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkShopVO, SkShopForm, SkShopQuery } from '@/api/app/SkShop/types';

/**
 * 查询商家信息列表
 * @param query
 * @returns {*}
 */

export const listSkShop = (query?: SkShopQuery): AxiosPromise<SkShopVO[]> => {
  return request({
    url: '/app/SkShop/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商家信息详细
 * @param id
 */
export const getSkShop = (id: string | number): AxiosPromise<SkShopVO> => {
  return request({
    url: '/app/SkShop/' + id,
    method: 'get'
  });
};

/**
 * 新增商家信息
 * @param data
 */
export const addSkShop = (data: SkShopForm) => {
  return request({
    url: '/app/SkShop',
    method: 'post',
    data: data
  });
};

/**
 * 修改商家信息
 * @param data
 */
export const updateSkShop = (data: SkShopForm) => {
  return request({
    url: '/app/SkShop',
    method: 'put',
    data: data
  });
};

/**
 * 删除商家信息
 * @param id
 */
export const delSkShop = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkShop/' + id,
    method: 'delete'
  });
};
